UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wS3VMajgSNMdyo2HSOgEkoYlTbqnxXB8IrKALOm6wEU='
WHERE
key_id = '02d69c45d4786d4a9202e08853f058af150a445869d8ea7e535fecc1fd13c90f'
AND (
token = 'wS3VMajgSNMdyo2HSOgEkoYlTbqnxXB8IrKALOm6wEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)