UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '21E6JbwZddM8/9ntk5jEBQeC47NQvunXTuscFDmztUs='
WHERE
key_id = 'c8338573540163d1531cffeeaabb627d05647138ebd788ed80723a75c279ced4'
AND (
token = '21E6JbwZddM8/9ntk5jEBQeC47NQvunXTuscFDmztUs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)