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