UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uc35aFTy3hRvsy8Dhe//wTu/KoXZtnT2iv44moJEwAU=' 
WHERE 
  key_id = 'a76c8471807d5d42c25bee1d2e9058c7504358e7666a1d7d7350da6feb03a72d' 
  AND (
    token = 'uc35aFTy3hRvsy8Dhe//wTu/KoXZtnT2iv44moJEwAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024