UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w8AM3ZE5L5w3Hq++Tua4rSYeoaIplF5oixlfSoPPlO0=' 
WHERE 
  key_id = 'a7c1481fbfa59acb6dfa7737147212ab09d24190ce84ba87960dcc14feac9eac' 
  AND (
    token = 'w8AM3ZE5L5w3Hq++Tua4rSYeoaIplF5oixlfSoPPlO0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022