UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O9qIsIBOS1fBdq9imVl1CZkS7X5zeS83yMD/Ys9nJc0=' 
WHERE 
  key_id = '0760f2c34932d1d4b134b19de537a9ade240901955631057139dbce6e3d15f1d' 
  AND (
    token = 'O9qIsIBOS1fBdq9imVl1CZkS7X5zeS83yMD/Ys9nJc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034