UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TcVZ9++oTcBww5XxOTpwcpUNe7mUeqSzvQYZddAamTM='
WHERE
key_id = 'a9958048081abc3901d386aafab5ca1a25b64e30edaa81782b03d1863c8a51c5'
AND (
token = 'TcVZ9++oTcBww5XxOTpwcpUNe7mUeqSzvQYZddAamTM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)