UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hr1EkwIaiB6wRe7C6bzs1zuYbeI87EVP/++f6LdPAKQ=' 
WHERE 
  key_id = '7057984cff8a43a7a67f87ad0f8f55a64e5307a72712266263782b5239025bf1' 
  AND (
    token = 'hr1EkwIaiB6wRe7C6bzs1zuYbeI87EVP/++f6LdPAKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026