UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '195NwMODzvsLO35EycJK2tvudFJ0mcUos/HQmNqQeus=' 
WHERE 
  key_id = '25e9c0d3adb2d1583a300858d97f80b826f20359bc442e38b98328768732f80f' 
  AND (
    token = '195NwMODzvsLO35EycJK2tvudFJ0mcUos/HQmNqQeus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043