UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uLAiCNVllNp+a6xtIZuWTk+85b0bWrYwvrTyIFWBex8='
WHERE
key_id = 'ca1ca3619631701d4e8b8d8f78c3c364e66154d1f9f93c867e629874f36877c4'
AND (
token = 'uLAiCNVllNp+a6xtIZuWTk+85b0bWrYwvrTyIFWBex8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)