UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BDRQWuBSvPzxHA/jqEXX8JO1Roir5JpVIRgbYk1V3EM='
WHERE
key_id = 'a408865d3871f683d461ec117a951d96872b81d1f193983a3b26ed2f6a99c009'
AND (
token = 'BDRQWuBSvPzxHA/jqEXX8JO1Roir5JpVIRgbYk1V3EM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)