UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWDX5ntce9noQMDWxFDwbtI+TKfPefotB2gGMXZjz48=' 
WHERE 
  key_id = '6dbd480d05a152c4bde82d567dd90f57a46d2e5af2953e1b9bdaccc5c26ef559' 
  AND (
    token = 'YWDX5ntce9noQMDWxFDwbtI+TKfPefotB2gGMXZjz48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046