UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sQk1CTIHDVYz7lPg8n8yMd4NSa0gWQOA2EqogQolKQc='
WHERE
key_id = 'f604d44655d0133905de49454ea9a9ba1dc08e9bf796c7b99162b8f04252fceb'
AND (
token = 'sQk1CTIHDVYz7lPg8n8yMd4NSa0gWQOA2EqogQolKQc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)