UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6OgWFvWe5BoryyAwjML7PPG6qGv1Xk6mBa/eZuru8W8='
WHERE
key_id = 'a5b01cc46c7fca990690626d379b54d0b38bee469fe93f809228318392fb40aa'
AND (
token = '6OgWFvWe5BoryyAwjML7PPG6qGv1Xk6mBa/eZuru8W8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)