UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YKOYhyvnlOc1el1IJHtMVOBw1OgnNcziSsHNBRloKrE=' 
WHERE 
  key_id = '070afa86a4975acd9bd38cf5b5926492eafde6646144db5e1f3713d7df2d9e9d' 
  AND (
    token = 'YKOYhyvnlOc1el1IJHtMVOBw1OgnNcziSsHNBRloKrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034