UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jA5FpODdAIUF7gkiDB8tyKiahdBRJ7pXpKHDZE687u4='
WHERE
key_id = '7d71851e8849c956ce406493153b02bdbc2d803ef89c9cd7093c0c3a5c7291a9'
AND (
token = 'jA5FpODdAIUF7gkiDB8tyKiahdBRJ7pXpKHDZE687u4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)