UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bs+ph4DCnT5dgU73P+DWi79eQG9sAhytdA8pl1cGuKo=' 
WHERE 
  key_id = '1dfb889a37911f7c1aef0f9e305fb9454af2d86653e2c4a9b3b705fcab7a407d' 
  AND (
    token = 'Bs+ph4DCnT5dgU73P+DWi79eQG9sAhytdA8pl1cGuKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00279