UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e62I/PkKYEZbUu/8DUJEu6uUuj2K+eY/Z2V10ARMi30=' 
WHERE 
  key_id = '407eee5d5c86b8c0d517b4b3b27375d6c06c4c10dd2e09ea37c2dcee4063b670' 
  AND (
    token = 'e62I/PkKYEZbUu/8DUJEu6uUuj2K+eY/Z2V10ARMi30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036