UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cQlVNuTD6oO8Hzd/F1R7WBHdST3UYU8+3mSlfwA/xNA=' 
WHERE 
  key_id = '40533fef3c611af8bd6a3bc9a10e581fb574b54d662c2357b790a98d1dc6d5c7' 
  AND (
    token = 'cQlVNuTD6oO8Hzd/F1R7WBHdST3UYU8+3mSlfwA/xNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021