UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nOvyrC0a4mbv/weGPxj5ZdXKIGZwJLfVXprDvltEurw='
WHERE
key_id = '12214b9ddf94a9ff0120a36cba52fe2b44d4b9b1a583157803792d36b5baad73'
AND (
token = 'nOvyrC0a4mbv/weGPxj5ZdXKIGZwJLfVXprDvltEurw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)