UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tICPZ64d7Hs+eaFwpqd4OIMeOs3t92eRw5/xia41ONc='
WHERE
key_id = 'a1ba96f2dce897ea4b9efe2a298bf1879eef52981242566cf60cab9e82ec75b9'
AND (
token = 'tICPZ64d7Hs+eaFwpqd4OIMeOs3t92eRw5/xia41ONc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)