UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O+ysfyWBi9RxslgMXsS4PJjNiBB68gYiZfATJHGdmpE=' 
WHERE 
  key_id = '1575e5b7e51dd294c790f6dd2eb3194767bce45195dd1c9d8f2faa0320783d81' 
  AND (
    token = 'O+ysfyWBi9RxslgMXsS4PJjNiBB68gYiZfATJHGdmpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022