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