UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zdAcOZ4iz8t3eOj86K8WM27vYGED/1dlt9kLWO/damo=' 
WHERE 
  key_id = '183d8c0b003227b8949f290056da3d05a61fe0474281405d3325fa336297fec3' 
  AND (
    token = 'zdAcOZ4iz8t3eOj86K8WM27vYGED/1dlt9kLWO/damo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030