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