UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bh5ycwYb5HWXNcMreIdXsUaMXa8kgSEknRuboEraMIA='
WHERE
key_id = 'a4eebe702c328bbe823dad437825e12e0e7f86684cb0669d74e7add59d5ebca5'
AND (
token = 'Bh5ycwYb5HWXNcMreIdXsUaMXa8kgSEknRuboEraMIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)