UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6K4d8L2HMBKEvjObTL1RllLBpbv+8gUTdAQLxw+EORY=' 
WHERE 
  key_id = '4bbc3b20564092c115bf02c6b78f74b6eb16e11adf722e202487f31cc4efcdc5' 
  AND (
    token = '6K4d8L2HMBKEvjObTL1RllLBpbv+8gUTdAQLxw+EORY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039