UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zQ9Jnyx8pBVhD2OeRyniGovXKABoG9AmVhlJ7JvUsRA=' 
WHERE 
  key_id = '5be71e65386d669d5c042983466c8ec87414db4aca19df442ad26d3e6c5cf456' 
  AND (
    token = 'zQ9Jnyx8pBVhD2OeRyniGovXKABoG9AmVhlJ7JvUsRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035