UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SKkNt9uLltg7ZRsoY55vA/Uu/xKbvHgmQjVZYHHdYoM='
WHERE
key_id = 'a50688c836083620baf210db608e4d415cb2c33e318904f4edf1957db5cace32'
AND (
token = 'SKkNt9uLltg7ZRsoY55vA/Uu/xKbvHgmQjVZYHHdYoM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)