UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ttTfR4UF81mv1U3EP9Y5xtkRYXy/Lc1f3mvfoVH+yL4=' 
WHERE 
  key_id = '0242871473d0c8c67dd88f35158582b05ef87797526d67153ba7bfaa63bca080' 
  AND (
    token = 'ttTfR4UF81mv1U3EP9Y5xtkRYXy/Lc1f3mvfoVH+yL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062