UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8GIDWVzhebo0nsusxTvzUea8w/uUJOs0wotLDNi6NwM=' 
WHERE 
  key_id = '0590070f39e0b2e27354ba7b021b7eb8d3c452df69e8860dfdf4a42ac296f045' 
  AND (
    token = '8GIDWVzhebo0nsusxTvzUea8w/uUJOs0wotLDNi6NwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034