UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NQBSw2IaXSl1xyHgYOZ+auhjP7aojgeAWYRh1cvyol0=' 
WHERE 
  key_id = '8f0f2f4149bac709f896927908d4cc78556eeeacdcce8a3a5895049267073f20' 
  AND (
    token = 'NQBSw2IaXSl1xyHgYOZ+auhjP7aojgeAWYRh1cvyol0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022