UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iTUzkc7OXqUxKhAjugc7Z+zuRg6PMQi3U6RM0ELeNKg=' 
WHERE 
  key_id = '7c3925da2204545deac685e7daa8eaea1f0a82fa3895e54f08f281509d99e3c6' 
  AND (
    token = 'iTUzkc7OXqUxKhAjugc7Z+zuRg6PMQi3U6RM0ELeNKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023