UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qgRper1uOhnbpHvs8NoJCNuuScMn5JJGcGJKa+oMmEQ='
WHERE
key_id = 'c14c02df52553af52f2435593096cfc1fc49648001af4c691cb4c14b0061481a'
AND (
token = 'qgRper1uOhnbpHvs8NoJCNuuScMn5JJGcGJKa+oMmEQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)