UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x/wFdp4MPLNK1PojxQ7ZMZt8DzJeR89ytxodt0Q5zrM=' 
WHERE 
  key_id = '20e36fdad829cb9d39330c724432d3e5a72e880c7b5070b63d910947d85fa8ae' 
  AND (
    token = 'x/wFdp4MPLNK1PojxQ7ZMZt8DzJeR89ytxodt0Q5zrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030