UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9oeEzc9TfPxa+OizSjzfOFA7SsZeQeFWO73GMS0t5bY=' 
WHERE 
  key_id = '8a0b852491343f10d8e75bf87301b61e2cab73622428dec46a8548daf50d0705' 
  AND (
    token = '9oeEzc9TfPxa+OizSjzfOFA7SsZeQeFWO73GMS0t5bY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042