UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hnBSY5rz+uUaIQZICRmZvQSL3PfEOMFJlsHS50mHERo='
WHERE
key_id = '30ca5e463de30988c755e85d861904312bc4cef8cacaf67388cab67af6bbb9fc'
AND (
token = 'hnBSY5rz+uUaIQZICRmZvQSL3PfEOMFJlsHS50mHERo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)