UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWUIcud/VYX0J244o93sPLowFrV51aKtT0uNlq+R4Xo=' 
WHERE 
  key_id = 'f5b3aec741fbaf8560b5364cce2797a94b91fe77fc1110b7664fdd54bd594513' 
  AND (
    token = 'YWUIcud/VYX0J244o93sPLowFrV51aKtT0uNlq+R4Xo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054