UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bp+oJXyVfDbYDyG6Vk1D7HUSyzKot18j8jeHsrGMAp8=' 
WHERE 
  key_id = '544a2d1ea551922ee97e0fe4775e679f41f3b5451d13ffa517cf0d09a2e24bc5' 
  AND (
    token = 'Bp+oJXyVfDbYDyG6Vk1D7HUSyzKot18j8jeHsrGMAp8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040