UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uQD5c8DHnleycPfAyJq1I60D75urFJOadFK+cQwjIDg='
WHERE
key_id = '387f1b7ee1f08c808d01843555690238cc7ded8c1b64e094a26019bf6992fbec'
AND (
token = 'uQD5c8DHnleycPfAyJq1I60D75urFJOadFK+cQwjIDg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)