UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xgu4wdskEyIBXPtRu1yMgvl91jwS5mc2+WjS5+WW2pk='
WHERE
key_id = '02ab69e0a37a6da271618ee3b0ced757cbafa9604b9e36c8d4c915adfccac924'
AND (
token = 'Xgu4wdskEyIBXPtRu1yMgvl91jwS5mc2+WjS5+WW2pk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)