UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y4p1qIAUdH/9hhyBW6VFiwGWutjKkjKXFVbvvoafgu0=' 
WHERE 
  key_id = '9eee23b5a728f20647f794537bdc1e7ef42190971f21a44ac58e602be4538429' 
  AND (
    token = 'Y4p1qIAUdH/9hhyBW6VFiwGWutjKkjKXFVbvvoafgu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044