UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Em3YeQNlYpI0fwcTW+Er3QtkiEQEvpsDSkh8n2g5yuA=' 
WHERE 
  key_id = '1790ebacbae3ac8dd085b152dabbfe89a204aa9fbbde6bc2d9b6cd0b4d65674b' 
  AND (
    token = 'Em3YeQNlYpI0fwcTW+Er3QtkiEQEvpsDSkh8n2g5yuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025