UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bDqw4QBjSYC0Ih6WES+uZQ4O7JNh7lxlQICUXCsClyc=' 
WHERE 
  key_id = 'b0a9e725150d9d07be2b459612501f99fbb997b98042075c55a5881e795d3abf' 
  AND (
    token = 'bDqw4QBjSYC0Ih6WES+uZQ4O7JNh7lxlQICUXCsClyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050