UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R1ALr6GzWwV2MQEDNdVGPJ6BbERijZo9sszQLpb5CUI=' 
WHERE 
  key_id = '5642ac2ba68b45a1e24c122d49bc7d6a02e69603047357f9053c1bc7b9ff0bdc' 
  AND (
    token = 'R1ALr6GzWwV2MQEDNdVGPJ6BbERijZo9sszQLpb5CUI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030