UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w895p5gjDulTr3R9RS9OhlHkbirXTsixolcjnvse40Q='
WHERE
key_id = '42b7c34ee0b8f0b57d9e6894ad31826d7b36caf26a17d42812be6e3c9eae50fe'
AND (
token = 'w895p5gjDulTr3R9RS9OhlHkbirXTsixolcjnvse40Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)