UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cdqln3bQVq9CpY6ke9U7a9eMjr9s5KTj8EWuyrPcLkI='
WHERE
key_id = '136df3967bb7320e950f959d737793f55e189b01f780111c2bd36b74a4ca311c'
AND (
token = 'cdqln3bQVq9CpY6ke9U7a9eMjr9s5KTj8EWuyrPcLkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)