UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T7d38CiqfCeglDq27fKJeRZ0PhA+nkc6iNfuyMSmcLA='
WHERE
key_id = '5bac7a813feaa34292f2093ef00d6b90f1f1dbb225caedca59b36eb398eb230a'
AND (
token = 'T7d38CiqfCeglDq27fKJeRZ0PhA+nkc6iNfuyMSmcLA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)